<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .taobao{
            width: 520px;
            height: 280px;
            background-color: deepskyblue;
            margin: 100px auto;
            position: relative;
            overflow: hidden;
        }
        .taobao img{
            width: 100%;
            height: 100%;
        }
        .taobao .image{
            position: absolute;
            width: 500%;
            height: 100%;
            transition: all ease 1s;
        }
        .taobao .image li{
            float: left;
            width: 20%;
            height: 100%;
        }
        a {
            text-decoration: none;
            color: #050505;
        }
        li{
            list-style: none;
        }
        .arr-l,
        .arr-r{
            position: absolute;
            top: 50%;
            width: 20px;
            height: 30px;
            line-height: 30px;
            margin-top: -15px;
            background-color: rgba(0,0,0,.2);
            color: white;
        }
        .arr-l{
            left: 0;
            border-top-right-radius: 15px;
            border-bottom-right-radius: 15px;
        }
        .arr-r{
            right: 0;
            text-align: right;
            border-top-left-radius: 15px;
            border-bottom-left-radius: 15px;
        }
        .arr-l:hover,
        .arr-r:hover{
            background-color: rgba(0,0,0,.4);
        }
        .circle{
            position: absolute;
            left: 50%;
            bottom: 15px;
            width: 70px;
            margin-left: -35px;
            height: 13px;
            border-radius: 7px;
            background-color: rgba(255,255,255,.3);
        }
        .circle li {
            float: left;
            width: 8px;
            height: 8px;
            border-radius: 4px;
            background-color: lightpink;
            margin: 3px;
            cursor: pointer;
        }
        li.current{
            background-color: #ff5000;
        }

        .v-enter, .v-leave-to{
            opacity: 0;
            transform: translateX(80px);
        }
        .v-enter-active, .v-leave-active{
            transition: all 0.4s ease;
        }
    </style>
</head>
<body>
    <div class="taobao" id="box">
        <a href="#" class="arr-l"> &lt; </a>
        <a href="#" class="arr-r"> &gt; </a>
        <ul class="image" :style="temp">
            <li v-for="item in imagePaths"><img :src="item" alt=""></li>
        </ul>
        <ul class="circle">
            <li v-for="i in 5" @click="toggle($event)" :key="i" :id="i"></li>
        </ul>
    </div>
    <script>
        var vm = new Vue({
            el:"#box",
            data:{
                imagePaths:["upload/pic1.jpg","upload/pic2.jpg","upload/pic3.jpg","upload/pic4.jpg","upload/pic5.jpg"],
                temp:{left:0}
            },
            methods:{
                toggle(e){
                    let id=e.target.id-1;
                    this.temp.left=-id*100+'\%';
                    let lis=e.target.parentNode.children;
                    for(let i=0;i<lis.length;++i){
                        lis[i].className='';
                    }
                    e.target.className='current';
                }
            },
            mounted(){
                let ul=document.querySelector('.circle');
                let li=ul.querySelector('li');
                li.className='current';
            }
        })
    </script>
</body>
</html>